#ifndef __I2C_H
#define __I2C_H

#include <stm32f4xx.h>
#include <stdio.h>
#include "delay.h"
#include "sys.h"

#define SCL_W	PBout(8)

#define SDA_W	PBout(9)
#define SDA_R	PBin(9)


extern void sda_pin_mode_9(GPIOMode_TypeDef pin_mode);

extern void i2c_start(void);

extern void i2c_stop(void);

extern void i2c_send_byte(uint8_t txd);

extern uint8_t i2c_wait_ack(void);

extern void eeprom_init(void);

extern int32_t eeprom_write(uint8_t addr,uint8_t *buf,uint32_t len);

extern void i2c_ack(uint8_t ack);

extern uint8_t i2c_recv_byte(void);

extern int32_t eeprom_read(uint8_t addr,uint8_t *buf,uint32_t len);


#endif  // I2C_H
